package com.yang.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yang.demo.entity.User;
import com.yang.demo.mapper.UserMapper;
import com.yang.demo.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import java.util.List;

/**
 * 实现类
 */
@Service  //将这个类交给spring管理
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Resource
    private UserMapper userMapper;  //定义了操作数据库的一些方法（函数）

    @Override //重写方法
    public User getUser(Integer id) {
        return userMapper.selectById(id);
    }

    @Override
    public List<User> selectAll(){
        return userMapper.getAll();
    }
}
